package ca.liu.scaffoldingmvctest.web;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Unit test for the <code>StLogController</code> controller.
 *
 * @see ca.liu.scaffoldingmvctest.web.StLogController
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"file:./src/main/resources/scaffoldingmvctest-security-context.xml",
		"file:./src/main/resources/scaffoldingmvctest-service-context.xml",
		"file:./src/main/resources/scaffoldingmvctest-dao-context.xml",
		"file:./src/main/resources/scaffoldingmvctest-web-context.xml" })
public class StLogControllerTest {
	/**
	 * The Spring application context.
	 *
	 */
	private ApplicationContext context;

	/**
	 * Test <code>editStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GeteditStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/editStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>newStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetnewStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/newStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>saveStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetsaveStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/saveStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>confirmDeleteStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetconfirmDeleteStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/confirmDeleteStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>deleteStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetdeleteStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/deleteStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>selectStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetselectStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/selectStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>listStLogStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetlistStLogStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/listStLogStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>indexStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetindexStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/indexStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>selectStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetselectStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/selectStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>editStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GeteditStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/editStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>saveStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetsaveStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/saveStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>newStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetnewStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/newStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>confirmDeleteStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetconfirmDeleteStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/confirmDeleteStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>deleteStLog()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetdeleteStLog() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/deleteStLog");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>stlogControllerbinaryaction()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetstlogControllerbinaryaction() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/stlogController/binary.action");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StLogController controller = (StLogController) context.getBean("StLogController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Returns a mock HttpServletRequest object.
	 *
	 */
	private MockHttpServletRequest getMockHttpServletRequest() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
		return request;
	}

	/**
	 * Returns a mock HttpServletResponse object.
	 *
	 */
	private MockHttpServletResponse getMockHttpServletResponse() {
		return new MockHttpServletResponse();
	}
}